$rules = Get-Content -Path 'rules.csv' -Raw -Encoding UTF8
$ruleObj = ConvertFrom-Csv -InputObject $rules

$ruleObj | ForEach-Object {
  $_ | Get-Member
}

netsh advfirewall export ".\firewall.xml"


# # 定义32位和64位应用程序的注册表路径
# $regPaths = @(
#     "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*", 
#     "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
# )

# # 遍历每个注册表路径
# foreach ($regPath in $regPaths) {
#     # 获取所有注册表项
#     $apps = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName }

#     # 遍历应用程序并提取其信息
#     foreach ($app in $apps) {
#         # 获取应用程序名称
#         $appName = $app.DisplayName
#         # 优先获取InstallLocation，如果没有，则尝试获取DisplayIcon
#         $installPath = if ($app.InstallLocation) { $app.InstallLocation } else { $app.DisplayIcon }

#         if ($installPath) {
#             # 输出应用程序的名称和路径
#             [PSCustomObject]@{
#                 Application = $appName
#                 Path        = $installPath
#             }
#         }
#     }
# }